﻿using Entitas;
using UnityEngine;

/// <summary>
/// Input Listen
/// </summary>
public class InputSystem : IExecuteSystem
{
    private readonly Contexts contexts;

    public InputSystem (Contexts contexts)
    {
        this.contexts = contexts;
    }
    

    public  void Execute ()
    {
        var playerInputEntity = contexts.input.CreateEntity ();
        playerInputEntity.AddInputComp (new Vector2 (
            Input.GetAxis("Horizontal"),
            Input.GetAxis("Vertical")
            ),
            Input.mousePosition,
            Input.GetMouseButton (0),
            Input.GetMouseButton (1)
            );
    }
}